#pragma once
#include <bits/stdc++.h>

#define maxCompoundNum 100
#define maxFuelNum 5
#define maxOxidizerNum 5
#define maxEleNum 150
#define eps 1e-06
#define eps2 1e-02

using namespace std;


static char currentPath[255];

static int test;

static int compoundNum;
static int fuelNum;
static int oxidizerNum;
static int eleNum;

static double R=8.31446261815324;
static double pAtm=101325;
static double TF;
static double charVel;
static double vcmImpulse;
static double optOF;
static int frzFlow;
static int optimum;

static struct element
{
    string name;
    int num;
    double mass;
}ele[maxEleNum];

static struct compoundData
{
    string name;
    int num;
    int itnNum;
    //Number of T intervals
    double atoNum[maxEleNum];
    double a[3][7];
    double b[3][2];
    double tLB[3];
    //Lower bound of T
    double stdH;
    double stdS;
    double stdMu;
    double Cp;
    double h;
    double mol;
    double mass;
    int phase;
    //gas:0  liquid&solid:1
    bool toBeCalc;
}compound[maxCompoundNum],fuel[maxFuelNum],oxidizer[maxOxidizerNum],propellant;

static struct equation
{
    double alpha;
    double c[maxCompoundNum];
    double A[maxEleNum][maxCompoundNum];
    double R[maxEleNum][maxEleNum];
    double a[maxEleNum];
    int N,M,L;
    int gasIdx[maxCompoundNum];
    int cdsIdx[maxCompoundNum];
    int cmpIdx[maxCompoundNum];
    int eleIdx[maxEleNum];
    //condensed number
    double p,T;
    //pressure,Temperature
    double mu[maxCompoundNum];
    double y[maxCompoundNum];
    double cG;
    double Phi[maxCompoundNum];
    double vecB[maxEleNum+maxCompoundNum+1];
    double matA[maxEleNum+maxCompoundNum+1][maxEleNum+maxCompoundNum+1];
    element ele[maxEleNum];
    double lambda[maxEleNum];
    double W;
    double X[maxCompoundNum];
    double XG;
    double hF;
    double molWeight;
    double cP,cV;
    double Gamma;
    double velocity;
}equ;

/*
static struct res
{
    double p,T;
    //pressure and temperature
    double frc[maxEleNum];
}chamber;
*/

static struct cmpRes
{
    string name;
    double frc;
}cmbCmp[maxCompoundNum],trtCmp[maxCompoundNum],extCmp[maxCompoundNum];

static struct properties
{
    double p;
    double T;
    double c;
    double cP,cV;
    double Ma;
    double Gamma;
    double molWeight;
    double h;
    double velocity;
    double lambda;
}chamber,nozzleInlet,nozzleThroat,nozzleExit;
